package etnorservice.etnor_service.mapper.projectMapper;


import etnorservice.etnor_service.domain.ProjectCategoryMapping;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProjectCategoryMappingMapper {
    @Insert("INSERT INTO project_category_mappings(project_id, category_id) VALUES(#{projectId}, #{categoryId})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int insert(ProjectCategoryMapping mapping);

    @Select("SELECT * FROM project_category_mappings WHERE project_id = #{projectId}")
    List<ProjectCategoryMapping> findByProjectId(Long projectId);

    @Delete("DELETE FROM project_category_mappings WHERE project_id = #{projectId}")
    int deleteByProjectId(Long projectId);
}